package proxy;

public class Proxy {

	boolean proxy;
	String host = "cache-etu.univ-lille1.fr";
	String port = "3128";
	
	public Proxy(boolean proxy){
		try {
			System.setProperty("http.proxyHost", host);
			System.setProperty("http.proxyPort", port);
			System.setProperty("https.proxyHost", host);
			System.setProperty("https.proxyPort", port);
		}
		catch (Exception e) {
				e.printStackTrace();
				System.out.println("probleme lors de la configuration du proxy");
		}
		
	}
	
	public void enable(){
		try {
			System.setProperty("http.proxyHost", host);
			System.setProperty("http.proxyPort", port);
			System.setProperty("https.proxyHost", host);
			System.setProperty("https.proxyPort", port);
			}
		catch (Exception e) {
			e.printStackTrace();
			System.out.println("probleme lors de la configuration du proxy");
		}
	}
	
	public void disable(){
		try{
			System.setProperty("http.proxyHost", "null");
			System.setProperty("http.proxyPort", "null");
			System.setProperty("https.proxyHost", "null");
			System.setProperty("https.proxyPort", "null");
		}
		catch(Exception e){
			e.printStackTrace();
			System.out.println("probleme lors de la configuration du proxy");
		}
		
	}
	
	public String getHost(){
		return host;
	}
	
	public void setHost(String host){
		this.host = host;
	}
	
	public String getPort(){
		return port;
	}
	
	public void setPort(String port){
		this.port = port;
	}
}
